﻿<link href="~/Scripts/jquery-easyui-extensions/validatebox/jeasyui.extensions.validatebox.css" rel="stylesheet" />
<script src="~/Scripts/jquery-easyui-extensions/validatebox/jeasyui.extensions.validatebox.rules.remote.js"></script>


<div class="easyui-panel" data-options="fit:true,border:false" style="padding:20px;">

    <input id="vTarget1" type="text" value="" /> &nbsp;<span>该控件用于判定新增时用户名是否重复</span>
    <br />
    <br /><br />
    <input id="vTarget2" type="text" value="seven" /> &nbsp;<span>该控件用于判定编辑[id为2]的用户信息时用户名是否重复</span>
    <br />
    <br /><br />
    <span style="color:red;">后台中已经存在以下数据：</span>
    <p>ID: 1   UserName: admin</p>
    <p>ID: 2   UserName: seven</p>
    <p>ID: 3   UserName: easyui</p>
    <p>ID: 4   UserName: extlib</p>
</div>

<script>
    $(function () {

        $("#vTarget1").validatebox({
            validType: ['remoteValidWithoutField["用户名","/Validatebox/CheckUserNameExist"]']
        });

        $("#vTarget2").validatebox({
            validType: ['remoteValidWithoutField["用户名","/Validatebox/CheckUserNameExist","2"]']
            //也可以这样调用
            //validType: ['remoteValidWithoutField["用户名","/Validatebox/CheckUserNameExist","2","string"]']
        });
    });
</script>

